<?
include_once("../../fckeditor/fckeditor.php");
include_once("../../config.inc.php");	
include_once ("../../class/mysqldb.inc.php");
$db=new mysqldb();
$TypeName = trim($TypeName);
if($_POST['act']=="edit"){
	$sql="update hy_b_paytype set TypeName = '".$TypeName."',Content='".$Content."' where ID = ".$id;
	$db->query($sql);
	exit("<script>location.href='pay_for.php';</script >");
}else if($_POST['act']=="add"){
	$sql="insert into hy_b_paytype (TypeName,Content) values('".$TypeName."','".$Content."')";
	//echo $sql; exit;
	$db->query($sql);
	exit("<script>location.href='pay_for.php';</script >");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Administrator's Control Panel</title>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script language="JavaScript">
<!--
function update(id,w){
	name = document.getElementById("TypeName"+id).value;
	location.href="?act=edit&id="+id+"&TypeName="+name;
}
function checkFrm(dom){
	if(dom.TypeName.value=="")
	{
		alert('请输入支付方式');
		dom.TypeName.focus();
		return false;
	}
	else
	{
		return true;
	}
}
function mOvr(src,clrOver)
{	
   if (!src.contains(event.fromElement))
	{	 src.bgColor = clrOver;
	}
}
function mOut(src,clrIn)
{	if (!src.contains(event.toElement))
	{	src.bgColor = clrIn;
	}
}
//-->
</script>
</head>
<body id="main" >
<?
$sql="SELECT * FROM `hy_b_paytype` where ID='$id'";
$db->query($sql);
$rs=$db->get_data();
if($rs)
{
	$strTypeName=$rs[0]['TypeName'];
	$strContent=$rs[0]['Content'];
	$act="edit";
}
else
{
	$act="add";
}
?>
<table summary="" id="pagehead" cellpadding="0" cellspacing="0" border="0" width="100%">
  <tr>
    <td><h1>付费方式 </h1></td>
  </tr>
</table>
<div style="height:20px;">&nbsp;</div>
<div style="background-color:#CCC; font-size:16px;">新增</div>
<div>
    <form action="" method="post" onsubmit="return checkFrm(this)" >
        <input name="act" type="hidden" value="<?=$act?>" />
        <input name="id" type="hidden" value="<?=$id?>" />
        付费方式:<input type="text" name="TypeName" id="addName" value="<?=$strTypeName?>"/><br />
        描述:
        <?php
            //建立fckeditor对象
            $oFCKeditor = new FCKeditor('Content');
            $oFCKeditor->BasePath = '../../fckeditor/';
            $oFCKeditor->ToolbarSet = 'Info';
            $oFCKeditor->Width = '100%' ;
            $oFCKeditor->Height = '300' ;
            $oFCKeditor->Value = $strContent ;
            $oFCKeditor->Create() ;
        ?>
        <br />
        <input type="submit" value="提交" />
    </form>
</div>
<?php include "../bottom.php"; ?>
</body>
</html>
